#include "CountSearch.h"
#include "Mutex.h"
#include <iostream>

using namespace std;

extern Mutex *s_mutex;
extern bool s_found;
extern int s_count;

CountSearch::CountSearch()
{	
}
CountSearch::~CountSearch(){}

void CountSearch::run()
{
	s_mutex->lock();
	while ( !s_found )
	{		
		s_mutex->wait();
		s_found = false;
		s_count++;		
	}
	s_mutex->unlock();
}